$(document).ready(function() {	
	$('.tipsy').tipsy({gravity: 'sw'});	
});
onMouseOverForBasket = function(intId) {
	$('#add' + intId).attr('src', HOST_STATICS + 'img/btn/add.gif');
	$('#minus' + intId).attr('src', HOST_STATICS + 'img/btn/minus.gif');
}
onMouseOutForBasket = function(intId) {
	$('#add' + intId).attr('src', HOST_STATICS + 'img/btn/add-inactive.gif');
	$('#minus' + intId).attr('src', HOST_STATICS + 'img/btn/minus-inactive.gif');
}
function deleteBasket(intTargetId) {
	if(confirm(basket_delete_confirm)) {
		$.getJSON(				
			HOST_VFRIEND + 'ajax/basketdel?targetid='+intTargetId+'&callback=?',		
			function(response) {					
				if(response['error'] == 0) {
					showUIMessage(response['msg']);
					$('.boxPayment tfoot').hide();
					$('.boxPayment tbody').html('');
					$('.boxPayment tbody').html('<tr><td colspan="5" align="center">'+basket_no_data+'</td></tr>');
				} else {
					alert(response['msg']);
				}
			}
		);
	}
}
function updateQuantity(intAct,intVal,intProductId) {
	$.getJSON(				
		HOST_VFRIEND + 'ajax/basket?act='+intAct+'&basketid='+intVal+'&productid='+intProductId+'&callback=?',		
		function(response) {					
			if(response['error'] == 0) {			
				var intQuantity = response['quantity'];				
				var intTprice	= response['tprice'];
				if(intQuantity > 0) {
					$('#quantity' + intVal).html(intQuantity);
					$('#price' + intVal).html(response['price']);
				} else {
					$('#trRow' + intVal).hide();					
				}
				if(intTprice == 0) {
					$('.boxPayment tbody').html('<tr><td colspan="5" align="center">'+basket_no_data+'</td></tr>');
					$('.boxPayment tfoot').hide();
				} else {
					$('#tprice').html(intTprice);
				}
			} else {
				alert(response['msg']);
			}
		}
	);
}